package com.stephen.mymall.controller;

import com.stephen.mymall.entity.User;
import com.stephen.mymall.entity.vo.Result;
import com.stephen.mymall.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.validation.Valid;

/**
 * @ author: stephen
 * @ create: 2020-03-17 20:22
 * @ description:
 **/
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/register")
    @ResponseBody
    public Object register(@RequestBody @Valid User user) {
        userService.register(user);
        return Result.success();
    }

}
